package com.sdweizan.sdk.bytedance.bean.refund.general;

import com.alibaba.fastjson.annotation.JSONField;
import com.sdweizan.sdk.bytedance.bean.BdBaseResponse;
import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@Data
public class BdGeneralQueryRefundResponse extends BdBaseResponse {
  @JSONField(name = "data")
  private RefundInfo refundInfo;

  @NoArgsConstructor
  @Data
  public static class RefundInfo {

    @JSONField(name = "refund_list")
    private List<Refund> refundList;
  }

  @NoArgsConstructor
  @Data
  public static class Refund {

    /** 退款创建时间，13位毫秒时间戳* */
    @JSONField(name = "create_at")
    private Long createAt;

    /** 系统订单信息，开放平台生成的订单号* */
    @JSONField(name = "order_id")
    private String orderId;

    /** 系统退款单号，开放平台生成的退款单号* */
    @JSONField(name = "refund_id")
    private String refundId;

    /** 退款状态:退款中-PROCESSING 已退款-SUCCESS 退款失败-FAIL* */
    @JSONField(name = "refund_status")
    private String refundStatus;

    @JSONField(name = "refund_total_amount")
    private Long refundTotalAmount;

    private String message;

    /** 开发者系统生成的退款单号* */
    @JSONField(name = "out_refund_no")
    private String outRefundNo;

    /** 退款时间，13位毫秒时间戳，只有已退款才有退款时间* */
    @JSONField(name = "refund_at")
    private Long refundAt;

    /** 1: 用户发起退款2: 开放者发起退款3: 过期自动退款4: 抖音客服退款5: 预约失败自动发起退款6: 开发者拒绝接单退款7: 后约单触发先买单退款* */
    @JSONField(name = "refund_source")
    private String refundSource;

    /***本次退款的商品单列表 ***/
    @JSONField(name = "item_order_detail")
    private List<BdRefundItemOrderDetail> itemOrderDetail;

    /** 退款审核信息* */
    @JSONField(name = "merchant_audit_detail")
    private List<MerchantAudit> merchantAuditDetail;

    @Data
    public static class MerchantAudit {

      /** 退款审核状态：INIT：初始化TOAUDIT：待审核AGREE：同意DENY：拒绝OVERTIME：超时未审核自动同意* */
      @JSONField(name = "audit_status")
      private String auditStatus;

      /** 是否需要退款审核，1-需要审核2-不需要审核* */
      @JSONField(name = "need_refund_audit")
      private Integer needRefundAudit;

      /** 退款审核的最后期限，过期无需审核，自动退款，13 位 unix 时间戳，精度：毫秒* */
      @JSONField(name = "refund_audit_deadline")
      private Long refundAuditDeadline;

      /** 不同意退款信息* */
      @JSONField(name = "deny_message")
      private String denyMessage;
    }
  }
}
